package com.jsb.laundry.model.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 活动详情
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ActivityModuleDetail {

    //用户id
    private String userId;

    //原价格
    private int total;

    //实际支付金额
    private int realPayTotal;

    // 使用的优惠卡券
    private String cardId;

    private List<OrderInfo> orderInfoList;

    /**
     * 订单信息 计算实际支付金额
     */
    @Data
    public static class OrderInfo {
        //商品id
        private String goodsId;
        //购买量
        private int buyNum;
        // 服务id
        private String serveId;
        // 服务价格
        private String servePrice;
    }

    /**
     * 上门取衣地址、电话、名字
     */
    private String userAddressIdCome;
    private String userAddressCome;
    private String userAddressComePhone;
    private String userAddressComeName;
    /**
     * 衣物送会地址、电话、名字
     */
    private String userAddressIdBack;
    private String userAddressBack;
    private String userAddressBackPhone;
    private String userAddressBackName;
    //使用的优惠券id
    private String couponId;
    //活动id
    private String activityId;
    //洗衣上图片
    private String laundryPic;
    //商品说明
    @JsonIgnore
    private String goodsIntroduce;
    private List goodsIntroduceList = new ArrayList<>();
    //详情图片
    @JsonIgnore
    private String detailPic;
    private List detailPicList = new ArrayList<>();

    // 价格
    private String goodsPrice;

    public void setGoodsPrice(String goodsPrice) {
        if (goodsPrice == null) {
            return;
        }
        this.goodsPrice = goodsPrice + "起";
    }

    //销量
    private int goodsSales;
    //标题
    private String title;
    //详情
    private String detail;
    private Date appointmentTime;

    private String payId;
    private String orderId;
    private int buyNum;
    private String serveId;
    //是否拉起校服的购买列表数据
    private int flag;
    // 校服价格列表
    List<ActivityDetail> goodsData = new ArrayList<>();

    @Data
    public static class ActivityDetail{
        //校服卡券id
        private String holdSchoolCardId;
        //活动id
        private String goodsId;
        // 价格
//    private String goodsPrice;
        private String servePrice;
        // 商品标题
        private String goodsTitle;
        private String goodsServeDesc="校服包月";
        // 商品图片
        private String goodsPic;
        private String serveId;


        private String payId;
        private String orderId;
        @JsonFormat(pattern ="yyyy-MM-dd HH:mm:ss",timezone ="GMT+8")
        private Date payTime;
        @JsonFormat(pattern ="yyyy-MM-dd HH:mm:ss",timezone ="GMT+8")
        private Date appointmentTime;
        @JsonFormat(pattern ="yyyy-MM-dd",timezone ="GMT+8")
        private Date enableTime;
        /**
         * 是否被使用（0：未使用，1：已使用）
         */
        private String useFlag;
        private String userId;
    }
}
